package task5;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/5/4 9:09
 * @description:
 */
public class CopyFileTry {
  public static void main(String[] args) {
    BufferedWriter bw=null;
    BufferedReader br=null;
    try {
      br=new BufferedReader(new FileReader("c.txt"));
      bw=new BufferedWriter(new FileWriter("c:\\a.txt"));
      String line=null;
      while((line=br.readLine())!=null){
        bw.write(line);
        bw.newLine();
      }
    }catch (Exception e){
      System.out.println(e.getMessage());
    }finally {
      if(br!=null){
        try {
          br.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      if(bw!=null){
        try {
          bw.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
  }
}
